package study01

class Student(name: String,age: Int) {
    def printInfo(): Unit = {
      println(name+" "+age+" "+Student.school)
    }
}

//伴生对象
object Student{
  var school: String = "南阳理工"

  def main(args: Array[String]): Unit = {
    val student1 = new Student("张三", 18)
    val student2 = new Student("李四", 18)
    student1.printInfo()
    student2.printInfo()
  }
}
